import http from '@/utils/request.js';
export const getDetail = (data) => {
	// return http.get('/admin/maintain/malfunction/work/detail', data);
	return http.request({
		url: '/admin/maintain/malfunction/work/detail',
		method: 'get',
		data,
	});
};
// 修改电梯信息

export const updateElevtor = (data) => {
	// return http.post('/repair/maintain/elevator/v2/update/',data,true);
	return http.request({
		url: '/repair/maintain/elevator/v2/update/',
		method: 'post',
		data,
		textJson: true,
	});
};

// 获取维修记录详情
export const getRecord = (data) => {
	// return http.get('/repair/maintain/malfunction/history/detail',data);
	return http.request({
		url: '/repair/maintain/malfunction/history/detail',
		method: 'get',
		data,
	});
};
// 新增维保记录
export const addRecord = (data) => {
	// return http.post('/repair/maintain/malfunction/history/saveBatch',data,true);
	return http.request({
		url: '/repair/maintain/malfunction/history/saveBatch',
		method: 'post',
		data,
		textJson: true,
	});
};
// 修改维修记录详情
export const updateRecord = (data) => {
	// return http.post('/repair/maintain/malfunction/history/update',data,true);
	return http.request({
		url: '/repair/maintain/malfunction/history/update',
		method: 'post',
		data,
		textJson: true,
	});
};

// 删除作业部件记录
export const deleteCheckContent = (data) => {
	// return http.get('/repair/maintain/malfunction/history/delete',data);
	return http.request({
		url: '/repair/maintain/malfunction/history/delete',
		method: 'get',
		data,
	});
};

// 获取所有部件
export const getPart = (data) => {
	// return http.get('/repair/maintain/checkcontent/list',data);
	return http.request({
		url: '/repair/maintain/checkcontent/list',
		method: 'get',
		data,
	});
};

// 更新任务
export const updateOrder = (data) => {
	// return http.post('/repair/maintain/plan/content/update',data,true);
	return http.request({
		url: '/repair/maintain/plan/content/update',
		method: 'post',
		data,
		textJson: true,
	});
};

// 查看任务跟踪
export const repairLog = (data) => {
	// return http.get('/repair/maintain/malfunction/log/list',data);
	return http.request({
		url: '/repair/maintain/malfunction/log/list',
		method: 'get',
		data,
	});
};
// 根据id修改维修类型

export const maintenanceType = (data) => {
	// return http.post('/repair/maintain/malfunction/history/update/of/planId',data);
	return http.request({
		url: '/repair/maintain/malfunction/history/update/of/planId',
		method: 'post',
		data,
	});
};
// 查询详情 10.19
export const fetchDetail = (data) => {
	// return http.get('/repair/maintain/malfunction/work/detail',data);
	return http.request({
		url: '/repair/maintain/malfunction/work/detail',
		method: 'get',
		data,
	});
};
// 新增或修改维修工单历史项
export const update = (data) => {
	// return http.post('/repair/maintain/malfunction/work/update/history',data, true);
	return http.request({
		url: '/repair/maintain/malfunction/work/update/history',
		method: 'post',
		data,
		textJson: true,
	});
};
// 删除
export const del = (data) => {
	// return http.del('/repair/maintain/malfunction/work/remove/history',data);
	return http.request({
		url: '/repair/maintain/malfunction/work/remove/history',
		method: 'DELETE',
		data,
	});
};
// 获取部件列表
export const repairFittingSelected = (data) => {
	// return http.get('/repair/maintain/malfunction/work/parts/tree', data);
	return http.request({
		url: '/repair/maintain/malfunction/work/parts/tree',
		method: 'get',
		data,
	});
};

// 获取搜索时部件列表
export const repairFittingSearch = (data) => {
	// return http.get('/repair/maintain/malfunction/work/parts/tree/v2', data);
	return http.request({
		url: '/repair/maintain/malfunction/work/parts/tree/v2',
		method: 'get',
		data,
	});
};

// 维修完成
export const finish = (data) => {
	// return http.post('/repair/maintain/malfunction/work/finish',data,true);
	return http.request({
		url: '/repair/maintain/malfunction/work/finish',
		method: 'post',
		data,
		textJson: true,
	});
};

// 维修记录
export const setRecord = (data) => {
	// return http.post('/repair/maintain/malfunction/history/save/record',data,true);
	return http.request({
		url: '/repair/maintain/malfunction/history/save/record',
		method: 'post',
		data,
		textJson: true,
	});
};
// 维修完成时候提交故障原因
export const falutReason = (data) => {
	// return http.get('/repair/maintain/malfunction/work/fault/reason',data);
	return http.request({
		url: '/repair/maintain/malfunction/work/fault/reason',
		method: 'get',
		data,
	});
};

// 配件更换数量
export const getPartListCounts = (data) => {
	// return http.get('/repair/maintain/malfunction/work/getPartListCounts', data);
	return http.request({
		url: '/repair/maintain/malfunction/work/getPartListCounts',
		method: 'get',
		data,
	});
};

// 维保端新增自定义部件log
export const addLog = (data) => {
	// return http.post('/repair/custompartslog/add/log',data,true);
	return http.request({
		url: '/repair/custompartslog/add/log',
		method: 'post',
		data,
		textJson: true,
	});
};

// 根据维修工单数据生成报告
export const getReportInfoByRepairPlan = (data) => {
	// return http.get('/maintain/report/select/by/wx/plan', data,);
	return http.request({
		url: '/maintain/report/select/by/wx/plan',
		method: 'get',
		data,
	});
};
// 根据维修工单数据生成报告
export const getReportDetail = (data) => {
	// return http.get('/maintain/report/detail', data,);
	return http.request({
		url: '/maintain/report/detail',
		method: 'get',
		data,
	});
};
// 根据维修工单数据生成报告
export const addOrUpdateReport = (data) => {
	// return http.post('/maintain/report/submit', data, true);
	return http.request({
		url: '/maintain/report/submit',
		method: 'post',
		data,
		textJson: true,
	});
};
// 立即发送报告
export const sendReport = (data) => {
	// return http.post(`/maintain/report/send/${data.reportId}`, data, true);
	return http.request({
		url: `/maintain/report/send/${data.reportId}`,
		method: 'post',
		data,
		textJson: true,
	});
};
// 根据维修工单获取报告统计
export const getReportCountByRepair = (data) => {
	// return http.get('/maintain/report/select/by/wx/count', data);
	return http.request({
		url: '/maintain/report/select/by/wx/count',
		method: 'get',
		data,
	});
};
// 根据电梯ID获取报告配置
export const getReportConfig = (data) => {
	// return http.get('/maintain/report/select/elevator/config/result', data);
	return http.request({
		url: '/maintain/report/select/elevator/config/result',
		method: 'get',
		data,
	});
};
// 添加报告发送记录
export const addSendReportLog = (data) => {
	// return http.post('/maintain/report/send/log', data, true);
	return http.request({
		url: '/maintain/report/send/log',
		method: 'post',
		data,
		textJson: true,
	});
};

// 提交保养任务故障原因
export const maintainplancontenSelect = (data) => {
	return http.request({
		url: '/sida-maintain-admin/maintainplancontentext/updateWxMalfunctionType',
		method: 'get',
		data,
	});
};

// 获取故障原因树形接口
export const falutCaseList = (data) => {
	return http.request({
		url: '/repair/wx/fault/cause/list',
		method: 'get',
		data,
	});
};
